package com.cms.bs.app.controller;

import com.cms.bs.app.model.${name};
import com.cms.bs.app.service.${name}Service;
import com.cms.bs.common.PageRS;
import com.cms.bs.common.RS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
* ${name}Controller
*/
@Controller
@RequestMapping(value = "/${v_name}")
public class ${name}Controller {

@Autowired
private ${name}Service ${v_name}Service;

@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public RS create(@RequestBody ${name} ${v_name}) {
return ${v_name}Service.create(${v_name});
}

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseBody
public RS delete(@PathVariable String id) {
return ${v_name}Service.delete(id);
}

@RequestMapping(method = RequestMethod.PUT)
@ResponseBody
public RS update(@RequestBody ${name} ${v_name}) {
return ${v_name}Service.update(${v_name});
}

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public RS get(@PathVariable String id) {
return ${v_name}Service.get(id);
}

@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public PageRS list(${name} ${v_name}) {
return ${v_name}Service.list(${v_name});
}

}
